from PIL import Image, ImageGrab

im = ImageGrab.grabclipboard()

if isinstance(im, Image.Image):
    print("Image: size : %s, mode: %s" % (im.size, im.mode))
    im.save("grab_grabclipboard.jpg")
elif im:
    for filename in im:
        try:
            print("filename: %s" % filename)
            im = Image.open(filename)
        except IOError:
            pass  # ignore this file
        else:
            print("ImageList: size : %s, mode: %s" % (im.size, im.mode))
else:
    print("clipboard is empty.")
